Skip to main content

Query Builder

The IQNOX Query Builder Widget is a powerful and intuitive tool designed to simplify complex query creation within the ThingWorx platform. Built on top of the popular jQuery QueryBuilder library, this widget provides a user-friendly, visual interface for building dynamic and nested queries without writing a single line of code.

Example

Query Builder example

Usage

The Query Builder Widget empowers both technical and non-technical users to:

  • Build advanced queries for infotables or data services
  • Filter large datasets efficiently based on dynamic criteria
  • Accelerate development time by eliminating the need for manual query coding
  • Enable end-users to customize filters in dashboards or reports directly

Properties

PropertiesTypeBindingDefaultDescription
CustomClassSTRING<>Enables you to define an html class to the top div of the widget. Multiple classes can be entered, separated by space.
DataINFOTABLE<An InfoTable containing the list of fields that can be used in the query builder and conditions can be added on
QueryQUERY<>Represents the current query. As users interact with the Query Builder, the Query is updated to reflect those changes.
DisplayFieldFIELDNAMEHow should the field be shown to the user. If empty, the name will be used.
BaseTypeFieldFIELDNAMEWhat baseType the field has, needed to identify what operators to show.
NameFieldFIELDNAMEThe name of the field, used inside the the Query property when filters are created.
SectionFieldFIELDNAMESplit the fields into sections.
ValuesFieldFIELDNAMEThe possible values if the field only allows a limited set of values.
AllowGroupsNUMBER<1000Number of allowed nested groups. Setting it to 0 will disable nested groups.
AllowAndBOOLEAN<trueAllow for AND conditions.
AllowOrBOOLEAN<trueAllow for OR conditions.
ContainsValidQueryBOOLEAN>Is the current query valid.
IsQueryEmptyBOOLEAN>The current query is empty (no rules).
DatePickerFormatSTRING(localized)<DD/MM/YYYY HH:mm:ssDisplay format for date values selected in a query. Format date using Format Complex. SimpleDateFormat rules are accepted, along with prefixes and suffixes.
ReadOnlyBOOLEANfalseIf enabled, the query builder will be read-only.

Services

PropertyTypeBindingDescription
ClearQueryEVENT<Clears the query.

Events

PropertyTypeBindingDescription
QueryChangedEVENT>Triggered when the query has changed.

DataShapes

To utilize the query builder, it is required to create a datashape that defines the fields intended to be used and displayed by it.

To constrain the selectable options on a specific field, the corresponding row in the dataset must include an infotable within the column mapped to the ValuesField. This infotable is required to conform to the IQNOX_CommonDisplayValue_DS datashape, which defines the structure of the permissible values.

IQNOX_CommonDisplayValue_DS
value: STRING    // actual value
display: STRING // text to show in the value dropdown
section: STRING // under what section should it be located
Behavior
  • If valid Data is provided for values, the Dropdown will display these server-provided options.
  • If no matching entry is found in Data for a column, the dropdown will fall back to the default behavior - using input from the user.
Important notes
  • Inserting a query programmatically that has more groups than allowed in AllowGroups will not register the entire query in the widget.